using System;
using System.Collections.Generic;
using System.Text;
using System.Data.SQLite;
using System.Data;
using System.Collections.Specialized;

namespace Test {
	class SqLit {

		static void MainC() {
			//System.Data.SQLite.SQLiteConnection con=new System.Data.SQLite.SQLiteConnection("Data Source=c:\\test.db;");


			////System.Data.SQLite.SQLiteCommand cmd=new System.Data.SQLite.SQLiteCommand("create table test(id int,val varchar(50))",con);
			////System.Data.SQLite.SQLiteCommand cmd=new System.Data.SQLite.SQLiteCommand("create table test(id int,val varchar(50))",con);
			//con.Open();
			//int ret=cmd.ExecuteNonQuery();
			//con.Close();
		}

		static void MainX() {


			//SQLiteConnection con=new SQLiteConnection("Data Source=c:\\wc.db;");
			//SQLiteCommand cmd=new SQLiteCommand("select * from nodes",con);
			//con.Open();
			//SQLiteDataReader rdr=cmd.ExecuteReader();

			//while(rdr.Read())
			//{
			//  object[] obj=new object[rdr.FieldCount];
			//  rdr.GetValues(obj);
			//  //NameValueCollection col=rdr.GetValues();
			//  //Console.WriteLine(col[1]);
			//}
			//con.Close();

			DataTable tab1=new DataTable();
			//using(SQLiteDataAdapter adp=new SQLiteDataAdapter("select * from nodes where local_relpath like '%LocMoves%'","Data Source=c:\\wc.db;"))
			//using(SQLiteDataAdapter adp=new SQLiteDataAdapter("select * from sqlite_master","Data Source=c:\\wc.db;"))
			using(SQLiteDataAdapter adp=new SQLiteDataAdapter("select name from sqlite_master where type='table' limit 500",@"Data Source=C:\Users\pziarek\AppData\Roaming\Mozilla\Firefox\Profiles\n8nqzrj3.default\places.sqlite"))
			//using(SQLiteDataAdapter adp=new SQLiteDataAdapter("select name from sqlite_master where type='table' limit 500",@"Data Source=C:\Users\pziarek\AppData\Local\Google\Chrome\User Data\Default\History"))
				//using(SQLiteDataAdapter adp=new SQLiteDataAdapter("select changed_author,count(*) from nodes group by 1 order by 2 desc","Data Source=c:\\wc.db;"))
				adp.Fill(tab1);
			foreach(DataRow row in tab1.Rows)
			{
				DataTable tab2=new DataTable();
				string table=row[0].ToString();
				using(SQLiteDataAdapter adp2=new SQLiteDataAdapter(string.Format("select * from {0} limit 500",table),@"Data Source=C:\Users\pziarek\AppData\Roaming\Mozilla\Firefox\Profiles\n8nqzrj3.default\places.sqlite"))
					//using(SQLiteDataAdapter adp=new SQLiteDataAdapter("select changed_author,count(*) from nodes group by 1 order by 2 desc","Data Source=c:\\wc.db;"))
					adp2.Fill(tab2);
			}
		}
		static void Main1() {
			//System.Data.SQLite.SQLiteConnection con=new System.Data.SQLite.SQLiteConnection("Data Source=c:\\wc.db;");
			System.Data.SQLite.SQLiteConnection con=new System.Data.SQLite.SQLiteConnection("Data Source=c:\\test.db;");
			//System.Data.SQLite.SQLiteCommand cmd=new System.Data.SQLite.SQLiteCommand("select * from sqlite_master",con);
			System.Data.SQLite.SQLiteCommand cmd=new System.Data.SQLite.SQLiteCommand("select * from sqlite_master",con);
			//System.Data.SQLite.SQLiteCommand cmd=new System.Data.SQLite.SQLiteCommand("select * from repository",con);
			//System.Data.SQLite.SQLiteCommand cmd=new System.Data.SQLite.SQLiteCommand("select * from wcroot",con);
			//System.Data.SQLite.SQLiteCommand cmd=new System.Data.SQLite.SQLiteCommand("select * from pristine",con);
			//System.Data.SQLite.SQLiteCommand cmd=new System.Data.SQLite.SQLiteCommand("select * from actual_node",con);
			//System.Data.SQLite.SQLiteCommand cmd=new System.Data.SQLite.SQLiteCommand("select * from lock",con);
			//System.Data.SQLite.SQLiteCommand cmd=new System.Data.SQLite.SQLiteCommand("select * from work_queue",con);
			//System.Data.SQLite.SQLiteCommand cmd=new System.Data.SQLite.SQLiteCommand("select * from wc_lock",con);
			//System.Data.SQLite.SQLiteCommand cmd=new System.Data.SQLite.SQLiteCommand("select * from nodes",con);
			//System.Data.SQLite.SQLiteCommand cmd=new System.Data.SQLite.SQLiteCommand("select * from externals",con);
			con.Open();
			SQLiteDataReader rdr=cmd.ExecuteReader();
			while(rdr.Read())
			{
				object[] row=new object[rdr.FieldCount];
				rdr.GetValues(row);
			}
			con.Close();

		}
	}
}
